package cn.fintecher.pangolin.service.business.model.request;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;

import javax.validation.constraints.NotNull;

/**
 * @Auther: xiaqun
 * @Description: 委前催记查询请求参数
 * @Date: 11:44 2019/10/12
 */

@Data
public class FindPreRecordRequest {
    @ApiModelProperty(value = "证件号")
    @NotNull(message = "personalId.is.required")
    private String certificateNo;

    public BoolQueryBuilder getBuilder() {
        BoolQueryBuilder builder = new BoolQueryBuilder();
        builder.must(QueryBuilders.matchPhraseQuery("flag", 0));
        builder.must(QueryBuilders.matchPhraseQuery("certificateNo.keyword", this.certificateNo));
        return builder;
    }
}
